<template>
	<view class="productItem" @click="goDetail">
		<view class="info-wrapper">
			<view class="info">
				<view class="title-wrapper">
					<view class="title-left">
						<view class="title">{{ source.supplierName }}</view>
						<uni-tag v-if="source.subjectType === 2" text="企业" class="type" type="success" size="mini" />
						<uni-tag v-else-if="source.subjectType === 3" text="个体户" class="type" type="primary"
							size="mini" />
						<uni-tag v-else-if="source.subjectType === 1" text="自然人" class="type" type="warning"
							size="mini" />
					</view>
					<uni-icons type="right" color="#898989" size="18"></uni-icons>
				</view>
				<view class="content-wrapper">
					<view class="content">
						<text>负责人：{{ source.manager }}</text>
						<text @click.stop="callPhone(source.managerTel)">电话：{{ source.managerTel }}</text>
					</view>
					<view class="content">
						<text>地址：{{ source.businessAddress }}</text>
					</view>
					<view class="content">
						<text v-if="source.supplierStatus === 3">入驻时间：{{ source.enterTime }}</text>
						<text v-else-if="source.supplierStatus === 0">填报时间：{{ source.createTime }}</text>
						<text v-else-if="source.supplierStatus === 1">申请时间：{{ source.statusTime }}</text>
						<text v-else-if="source.supplierStatus === 2">申请时间：{{ source.statusTime }}</text>
						<text v-else-if="source.supplierStatus === 4">暂停时间：{{ source.statusTime }}</text>
						<text v-else-if="source.supplierStatus === 5">冻结时间：{{ source.statusTime }}</text>
					</view>
				</view>
			</view>
		</view>
		<!-- <view class="btn-wrapper">
			<view class="date">
				下架时间：2024.07.30 17:53:09
			</view>
			<view class="btn primary">
				质检记录
			</view>
			<view class="btn">
				主体信息
			</view>
			<view class="btn">
				许可类目
			</view>
			<view class="btn">
				在售商品
			</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		props: {
			index: {
				type: Number,
				default () {
					return 0
				}
			},
			source: {
				type: Object,
				default () {
					return {}
				}
			}
		},
		data() {
			return {

			}
		},
		mounted() {

		},
		methods: {
			callPhone(tel) {
				uni.makePhoneCall({
					phoneNumber: tel
				})
			},
			goDetail() {
				//注册中
				if (this.source.supplierStatus === 0) {
					uni.navigateTo({
						url: '/subPage_supplier/register/index?id=' + this.source.id
					})
				} else {
					uni.navigateTo({
						url: '/subPage_supplier/supplierDetail?id=' + this.source.id
					})
				}

			}
		},
		components: {

		}
	}
</script>

<style lang="scss" scoped>
	.productItem {
		background-color: #ffffff;
		border-radius: 20upx;
		overflow: hidden;
		//padding: 20upx;

		.info-wrapper {
			display: flex;

			.product-image {
				width: 140upx;
				height: 140upx;
				margin-right: 20upx;
				border-radius: 10upx;
			}

			.info {
				flex: 1;

				.title-wrapper {
					display: flex;
					align-items: center;
					margin-bottom: 10upx;
					height: 80upx;
					background-color: #F5F6FA;
					padding: 0 20upx;

					.title-left {
						flex: 1;
						display: flex;
						align-items: center;
					}

					.title {
						max-width: 550upx;
						font-size: 32upx;
						font-weight: bold;
						text-overflow: -o-ellipsis-lastline;
						overflow: hidden; //溢出内容隐藏
						text-overflow: ellipsis; //文本溢出部分用省略号表示
						display: -webkit-box; //特别显示模式
						-webkit-line-clamp: 1; //行数
						line-clamp: 1;
						-webkit-box-orient: vertical; //盒子中内容竖直排列
						font-weight: bold;
					}

					.type {
						margin-left: 15upx;
					}
				}

				.content-wrapper {
					padding: 30upx 20upx;
					//border-bottom: 1upx dashed #D3D6E3;

					.content {
						display: flex;
						align-items: center;
						justify-content: space-between;
						font-size: 30upx;
						color: #575A6E;
						line-height: 34upx;
						margin-bottom: 20upx;

						&:last-child {
							margin-bottom: 0upx;
						}
					}
				}

			}
		}

		.btn-wrapper {
			display: flex;
			align-items: center;
			justify-content: flex-end;
			margin-top: 10upx;
			height: 90upx;

			.date {
				flex: 1;
				font-size: 24upx;
				color: #666;
			}

			.btn {
				padding: 5upx 30upx;
				background-color: #ffffff;
				border: 1upx solid #898989;
				border-radius: 10upx;
				font-size: 28upx;
				margin-left: 15upx;

				&.primary {
					color: #ffffff;
					background-color: #018737;
					border-color: #018737;
				}
			}
		}
	}
</style>